package com.hargasembako.core.entity;

import java.util.HashSet;
import java.util.Set;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.hargasembako.core.util.SearchJanitor;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Store {
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) 
	private Long id;	
	@Persistent
	private String name;
	@Persistent
	private String address;	
	@Persistent
	private String city;	
	@Persistent
	private String state;	
	@Persistent
	private String phone;	
	@Persistent
	private String fax;	
	@Persistent
	private String email;	
	@Persistent
	private String website;
	@Persistent
	private String latitude;
	@Persistent
	private String longitude;
    @Persistent
    private Set<String> fts;	
	
	public Store(String name, String address, String city, String state, String phone) {
		this.name = name;
		this.address = address;
		this.city = city;
		this.state = state;
		this.phone = phone;

		this.fts = new HashSet<String>();
        
        SearchJanitor.updateFTSStuff(this.toString(), this.fts);		
		
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}
	
	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getFax() {
		return fax;
	}

	public void setFax(String fax) {
		this.fax = fax;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getWebsite() {
		return website;
	}

	public void setWebsite(String website) {
		this.website = website;
	}
	
	public String getLatitude() {
		return latitude;
	}

	public void setLatitude(String latitude) {
		this.latitude = latitude;
	}

	public String getLongitude() {
		return longitude;
	}

	public void setLongitude(String longitude) {
		this.longitude = longitude;
	}

	public Set<String> getFts() {
		return fts;
	}

	public void setFts(Set<String> fts) {
		this.fts = fts;
	}
	
	public String toString(){
		return name +" "+ address +" "+ city + " " + state;		
	}
	
}
